
const numberUnit = (el, binding) => {
	// 判断是否为el-input-number
	if(el.classList.contains('el-input-number')) {
		let value = binding.value;
		let oWrapper = el.querySelector('.el-input__wrapper');
		let oUnit = oWrapper.querySelector('.number-unit');
		if(!value) {
			if(oUnit) {
				oUnit.remove();
			}
		} else {
			if(!oUnit) {
				oUnit = document.createElement('span')
        oUnit.className = 'number-unit';
        oUnit.style.paddingLeft = '8px';
        oUnit.style.color = '#999';
        oUnit.style.whiteSpace = 'nowrap';
        oUnit.style.lineHeight = 1;
        oWrapper.appendChild(oUnit)
			}
			oUnit.innerHTML = value;
		}
	}
}

export default numberUnit;